import React from 'react'
import { BrowserRouter, Navigate, useRoutes } from 'react-router-dom'


const Login = React.lazy(() => import('../Page/Login'))
const Home = React.lazy(() => import('../Page/Home'))


const routes = [
    {
        path: '/',
        element: <Navigate to='/home' />
    },
    {
        path: '/login',
        element: <Login />
    },
    {
        path: '/home',
        element: <Home/>
    }
]

function WrapperRoutes() {
    const ele = useRoutes(routes)
    return ele
}

export default function Router() {
    return (
        <BrowserRouter>
            <WrapperRoutes />
        </BrowserRouter>
    )
}
